package com.toprs.business.controller

import com.alibaba.fastjson2.JSONObject
import com.toprs.base.entity.User
import com.toprs.base.result.Result
import com.toprs.business.entity.Step
import com.toprs.business.service.StepService
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@RequestMapping("/steps")
@Tag(description = "流转信息", name = "流转信息")
class StepController(val stepService: StepService) {


    @GetMapping("/list/{id}")
    @Operation(summary = "根据申请id获取流转流程")
    fun getStepList(@PathVariable id: Int): Result<List<Step>> {
        val list: List<Step> = stepService.getStepList(id)
        return Result.success(list)
    }

    @GetMapping("/back-users/{id}")
    @Operation(summary = "根据申请id获取回退用户列表")
    fun getBackUserList(@PathVariable id: Int): Result<List<JSONObject>> {
        val list = stepService.getBackUserList(id)
        return Result.success(list)
    }


}